package org.wattdepot.cli.command;

import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import org.wattdepot.cli.processor.CommandLineInterface;

/**
 * Test Kit for List Summary - checks Parents and Subsources for correct content.
 * 
 * @author Remy Baumgarten
 * @author Kevin Chiogioji
 * 
 */
public class TestListSummary extends CommandLineInterface {
  /**
   * Test Method.
   * 
   * @throws Exception -
   */
  @Test
  public void parentOfSubSource() throws Exception {
    ListSummary summary = new ListSummary();
    List<String> args = new ArrayList<String>();
    args.add("SIM_KAHE_3");
    assertTrue("Checking List Summary Parent for SIM_KAHE_3", summary.doCommand(args).contains(
        "Parent: SIM_KAHE"));
  }

  /**
   * Check Parent of Source.
   * 
   * @throws Exception -
   */
  @Test
  public void parentOfSource() throws Exception {
    ListSummary summary = new ListSummary();
    List<String> args = new ArrayList<String>();
    args.add("SIM_KAHE");
    assertTrue("Checking List Summary Parent for SIM_KAHE", summary.doCommand(args).contains(
        "Parent: SIM_OAHU_GRID"));
  }

  /**
   * Check subsources of grid.
   * 
   * @throws Exception -
   */
  @Test
  public void subSourcesOfGrid() throws Exception {
    ListSummary summary = new ListSummary();
    List<String> args = new ArrayList<String>();
    args.add("SIM_OAHU_GRID");
    assertTrue("Checking Subsources of SIM_OAHU_GRID (Master Parents)", summary.doCommand(args)
        .contains("SIM_KAHE, SIM_WAIAU, SIM_HONOLULU, SIM_IPP"));
  }

  /**
   * Check input validation.
   * 
   * @throws Exception -
   */
  @Test
  public void inputValidation() throws Exception {
    ListSummary summary = new ListSummary();
    List<String> args = new ArrayList<String>();
    args.add("Bad_Value Testing");
    System.out.println(summary.doCommand(args));
    assertTrue("Testing Improper Input Handling", summary.doCommand(args).contains(
        "This resource is not available"));
  }

}
